package view.components.button {
	
	/**
	 * @author Alejandro
	 */
	
	import flash.display.Shape;
	import flash.display.Sprite;
	import view.components.text.CompleteText;
	
	public class ButtonDisplayState extends Sprite{
		private var bgColor:uint;
		private var widthProperty:Number;
		private var heightProperty:Number;
		

		public function ButtonDisplayState(globalPropertys:Object, statePropertys:Object) {
			this.bgColor = statePropertys.backgroundColor;
			this.widthProperty = globalPropertys.width;
			this.heightProperty = globalPropertys.height;
			draw();
			// En caso de haber seteado texto, se copian solo los atributos relevantes.
			if (globalPropertys.text != null) {
				var textPropertys:Object = {
					text:globalPropertys.text,
					width:globalPropertys.width,
					height:globalPropertys.height			
				}
				this.addChild(new CompleteText(textPropertys));
			}
		}
		
		public function draw():void {
			graphics.beginFill(bgColor);
			graphics.drawRoundRect(0, 0, widthProperty, heightProperty, heightProperty/2);
			graphics.endFill();
		}
	}
}
